package com.ibeeking.gmc.global.api.feign;

import com.ibeeking.gmc.global.api.feign.fallback.UpmsUserFallbackFactory;
import com.ibeeking.gmc.global.api.common.dto.TenantUserDTO;
import com.ibeeking.gmc.global.api.common.param.PermissionParam;
import com.ibeeking.nematos.utils.result.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * @Author ibeeking
 */
@FeignClient(name = "base-upms-b-server", contextId = "upmsTenantUserClient", path = "/b", fallbackFactory = UpmsUserFallbackFactory.class, decode404 = true)
public interface UpmsTenantUserClient {

    /**
     * @param mobile
     * @return
     */
    @PostMapping(value = "/user/feign/v1/queryByMobile/{mobile}")
    ResponseResult<TenantUserDTO> queryByMobile(@PathVariable("mobile") String mobile);

    /**
     * @param tenantId
     * @return
     */
    @PostMapping(value = "/user/feign/v1/queryByTenantId/{tenantId}")
    ResponseResult<List<TenantUserDTO>> queryByTenantId(@PathVariable("tenantId") Integer tenantId);

    /**
     * 查询模块菜单
     *
     * @param module
     * @return
     */
    @PostMapping(value = "/permission/feign/v1/menus/{module}")
    ResponseResult<List<Long>> menus(@PathVariable("module") @NotBlank(message = "模块不能为空") String module);

    /**
     * 更新菜单
     *
     * @param params
     * @return
     */
    @PostMapping(value = "/permission/feign/v1/configurePermission")
    ResponseResult<Boolean> configurePermission(@RequestBody List<PermissionParam> params);

    /**
     * 查询商户员工
     *
     * @param mobile
     * @return
     */
    @PostMapping(value = "/shop/feign/v1/queryByMobile/{mobile}")
    ResponseResult<TenantUserDTO> queryShopUserByMobile(@PathVariable("mobile") String mobile);
}
